import { BaseResponse } from "src/util";
import { MessageRecord } from "src/views/admin/AdminType";
import { request } from "../util";
export const sendToFriend = async (data: { to: string; content: string }) => {
	const result = await request.post("/admin/chat/toFriend", data);
	return result.data;
};
export const getLinkman = async (params: { page: number; pageSize: number } = { page: 1, pageSize: 10 }) => {
	const result = await request.get("/admin/chat/linkman", { params });
	return result.data;
};
export const addLinkman = async (data: { linkman: string }) => {
	const result = await request.post("/admin/chat/addLinkman", data);
	return result.data;
};
export const removeLinkman = async (data: { linkman: string }) => {
	const result = await request.delete("/admin/chat/removeLinkman", { data });
	return result.data;
};
export const getMessageList = async () => {
	const result = await request.get<BaseResponse<MessageRecord[]>>("/admin/chat/messageList");
	return result.data;
};
export const readMessage = async ({ from }: { from: string }) => {
	const result = await request.post("/admin/chat/readMessage", { from });
	return result.data;
};
